package com.pubinfo.passbook.api.controller.rule;

import com.pubinfo.passbook.common.entity.TRuleUser;
import com.pubinfo.passbook.common.model.dto.rule.RuleUserParam;
import com.pubinfo.passbook.common.model.vo.base.JsonResult;
import com.pubinfo.passbook.common.model.vo.base.MyPage;
import com.pubinfo.passbook.common.service.master.TRuleUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("rule/user/manager")
@Api(tags = "审核用户管理")
public class TRuleUserController {
  
  @Resource
  private TRuleUserService userService;
  
  @PostMapping("select")
  @ApiModelProperty("查询审核用户")
  public JsonResult<MyPage<TRuleUser>> selectRuleUser(@RequestBody RuleUserParam param) {
    return JsonResult.success(new MyPage(userService.selectRuleUser(param)));
  }
  
  @DeleteMapping("remove")
  @ApiModelProperty("删除审核用户")
  public JsonResult<Boolean> removeRuleUser(String id) {
    return JsonResult.success(userService.removeById(id));
  }
  
  @PostMapping("update")
  @ApiModelProperty("更新审核用户")
  public JsonResult<String> updateRuleUser(@RequestBody TRuleUser user) {
    return userService.updateRuleUser(user);
  }
  
  @PostMapping("save")
  @ApiModelProperty("新增审核用户")
  public JsonResult<String> saveRuleUser(@RequestBody TRuleUser user) {
    return userService.saveRuleUser(user);
  }
}
